package com.hp.jdkdynamicproxy;

import com.hp.staticproxy.CellphoneFactory;
import com.hp.staticproxy.CellphoneSales;
import com.hp.staticproxy.ComputerFactory;
import com.hp.staticproxy.ComputerSales;

public class TestJDK {

    static interface CCC{}
    static class AAA implements CCC{}

    public static void main(String[] args) {
        CellphoneSales factory1 = new CellphoneFactory();
        ComputerSales factory2 = new ComputerFactory();
        JdkShop jdkShop = new JdkShop();
        //传入被代理对象,生成代理对象
        CellphoneSales shop1 = (CellphoneSales) jdkShop.newProxyInstance(factory1);
        shop1.sell("小米");
        ComputerSales shop2 = (ComputerSales) jdkShop.newProxyInstance(factory2);
        shop2.sell("dell");

        CCC a = (CCC) jdkShop.newProxyInstance(new AAA());
    }
}
